function MenuBar(className, hoverClass) {
	if (!hoverClass) {
		hoverClass = "hover";
	}
	var menus = $(className);
	var currentMenu = menus.filter(".hover").get(0);
	menus.hover(function() {
		if (this != currentMenu) {
			$(this).toggleClass(hoverClass);
		}
	}).click(function() {
		$(this).siblings().removeClass(hoverClass);
		$(this).addClass(hoverClass);
		currentMenu = this;
	});
}

function ErrorDialog(ele, title) {
	this.ele = ele;
	this.ele.empty();
	if (!title) {
		title = "错误提示";
	}

	var html = [ '<div>', '<p class="message">', '</p>', '<div class="details">',

	'</div>', '<div class="bottombar">', '<a href="javascript:void(0)" class="easyui-linkbutton show" data-options="iconCls:\'icon-search\'">详情&gt;&gt;</a>',
			'<a href="javascript:void(0)" class="easyui-linkbutton ok" data-options="iconCls:\'icon-search\'">确认</a>', '</div>', '</div>' ];

	var self = this;

	this.content = $(html.join(''));
	this.message = this.content.children(".message");
	this.details = this.content.children(".details");
	this.details.hide();

	this.bottombar = this.content.children(".bottombar");

	this.okBtn = this.bottombar.children(".ok");
	this.okBtn.linkbutton().click(function() {
		self.ele.dialog("close");
	});

	this.showBtn = this.bottombar.children(".show");
	this.showBtn.linkbutton().click(function() {
		self.details.toggle();
	});

	this.ele.append(this.content);

	this.ele.dialog({
		title : title,
		width : 400,
		height : 200,
		closed : true,
		modal : true,
		resizable : true,
		draggable : true
	});
}

ErrorDialog.prototype.show = function(message, details) {
	if (this.textDetails) {
		this.textDetails.remove();
	}
	if (this.gridDetails) {
		this.gridDetails.remove();
	}

	if (!message) {
		message = "未知错误。";
	}
	this.message.html(message);

	if (details) {
		this.showBtn.show();

		this.textDetails = $("<textarea>" + details + "</textarea>");
		this.details.append(this.textDetails);
	} else {
		this.showBtn.hide();
	}

	this.ele.dialog("open");
};